﻿@model Free2AskModel.ACLGroup

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>

<fieldset>
    <legend>ACLGroup</legend>

    <div class="display-label">Name</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Name)
    </div>

    <div class="display-label">Description</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Description)
    </div>
</fieldset>
<p>
    @Html.ActionLink("Edit", "Edit", new { id=Model.ID }) |
    @Html.ActionLink("Back to List", "Index")
</p>
<fieldset>
    <legend>Add From Excel</legend>
    <label>Excel表格式：学号,姓名,性别</label>
    <p>
    @using (Html.BeginForm("AddACLMembers", "ACL", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <input type="file" name="file"/>
        @Html.TextBox("aclGroupID", Model.ID);
        <input type="submit" value="OK"/>
    }
    </p>
</fieldset>
<fieldset>
    <legend>Add Single ACL Member</legend>
    <p>
        @using(Html.BeginForm("AddSingleACLMember","ACL",FormMethod.Post))
        {
            @Html.TextBox("ACLGroupID", Model.ID)
            <h3>RealName</h3>@Html.TextBox("RealName")
            <h3>CardNo</h3>@Html.TextBox("CardNo")
            <h3>Gender</h3>@Html.TextBox("Gender")

            <input type="submit" value="OK" />
        }
    </p>
</fieldset>
<p>
    @using (Html.BeginForm("ClearGroupMemebers", "ACL", FormMethod.Post))
    {
        @Html.Hidden("aclGroupID",Model.ID)
        <input type="submit" value="Clear All Members" />
    }
</p>
<p>
@{
    var grid = new WebGrid(source:Model.ACLMembers.ToList());
}
@grid.GetHtml(
tableStyle:"table",
    columns:grid.Columns(
        grid.Column("CardNo"),
        grid.Column("RealName"),
        grid.Column("Gender"),
        grid.Column(
            header:"", 
            format:@<text>@Html.ActionLink("Delete","DeleteACLMember",new {ACLGroupID=Model.ID,CardNo=item.CardNo})</text>            
        )
    )
)
</p>